﻿using System;
using OpenAiClient.Models;
using Prism.Commands;
using Prism.Mvvm;

namespace OpenAiClient.ViewModels
{
    internal class TitleViewModel : BindableBase
    {
        public event Action OnMinimize = () => { };
        public event Action OnClose = () => { };
        public event Action<MenuType> OnMenuItemClicked = (_) => { };

        public DelegateCommand MinimizeCommand { get; }
        public DelegateCommand CloseCommand { get; }

        public MenuType CurrentMenuType
        {
            get => _currentMenuType;
            set
            {
                SetProperty(ref _currentMenuType, value);
                OnMenuItemClicked.Invoke(value);
            }
        }

        private MenuType _currentMenuType = MenuType.Search;

        public TitleViewModel()
        {
            MinimizeCommand = new DelegateCommand(() => { OnMinimize.Invoke(); });
            CloseCommand = new DelegateCommand(() => { OnClose.Invoke(); });

            //初始化菜单
            OnMenuItemClicked.Invoke(MenuType.Search);
        }
    }
}
